package mortal.common.error
{
	import Engine.error.*;
	import mortal.game.resource.*;
	
	public class ErrorCode extends Object
	{
		public static const ErrorLogin_NoRole:int = 33001;
		public static const ErrorCell_FightToEntityNotOnline:int = 38006;
		public static const ErroeCell_CollectToEntityNotOnline:int = 38050;
		public static const ErrorCell_ModeSetPeaceModeCdError:int = 38031;
		public static const ErrorPublic_CopyGroupNotExsit:int = 31255;
		public static const ErrorPublic_PlayerNotOnline:int = 40001;
		public static const ErrorCell_EscortIsAttacked:int = 38105;
		public static const ErrorCell_ObstructNotFight:int = 38034;
		public static const ErrorCell_CollectHasOwner:int = 38052;
		public static const ErrorGate_ZazenPlayerReject:int = 35852;
		public static const ErrorCell_FightTooFar:int = 38005;
		public static const ErrorCell_SkillTooFar:int = 38082;
		public static const ErrorCell_CollectDistanceTooFar:int = 38056;
		public static const ErrorCell_InputPointError:int = 38024;
		public static const ErrorGate_TransportHadTask:int = 35484;
		
		public function ErrorCode()
		{
		}
		
		public static function init() : void
		{
			new RMIErrorCode();
			new SystemErrorCode();
		}
		
		public static function getErrorStringByCode(code:int) : String
		{
			if (SystemErrorCode.isInError(code))
			{
				return SystemErrorCode.getErrorByCode(code);
			}
			if (RMIErrorCode.isInError(code))
			{
				return RMIErrorCode.getErrorByCode(code);
			}
			return ErrorCodeConfig.instance.getErrorStringByCode(code);
		}
		
		public static function getErrorByLogin(login:int) : String
		{
			if (SystemErrorCode.isInError(login))
			{
				return SystemErrorCode.getErrorByCode(login);
			}
			if (RMIErrorCode.isInError(login))
			{
				return RMIErrorCode.getErrorByCode(login);
			}
			return login + "";
		}		
	}
}
